#pragma once
#include <easyx.h>

class Button
{
private:
	int x1 = 0;
	int y1 = 0;
	int x2 = 0;
	int y2 = 0;
	char* text;
	int textsize = 20;
	int textcolor = BLACK;
	int fillcolor = TRANSPARENT;
	int linecolor = TRANSPARENT;
	bool flag = false;
	IMAGE butImageBlack;
	IMAGE butImageWhite;
public:
	// Default ctor
	Button() = default;

	// Ctor with custom data
	Button(int x_1, int x_2, int y_1, int y_2, const char* _text);

	// Reset the data field
	void Reset(int x_1, int x_2, int y_1, int y_2, const char* _text);

	// Draw the button
	void Draw();

	// Judge if the cursor is on the button
	bool button_judge(int x, int y);

	// Reverse the flag which implies the button is pressed or not
	void ReverseFlag();

	// Return the flag
	bool getFlag();

	// Load the image of the button
	void loadImage();
};
